<%@page contentType="text/html;charset=UTF-8"%>
<%@ page import="whf.framework.web.Constants"%>

<%@taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/tlds/framework.tld" prefix="framework"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title><bean:write name="STRUTS-META" property="name" /></title>
<jsp:include page="/common/inc/select.jsp" />

<script language="javascript">
	function loadTabs(){
        createTab("http://news.sina.com.cn", "Sina news", false);
        createTab("http://news.163.com", "163 news", false);
	}
	//
	var tabCount = 0;
	var currentTab = 0;
	function getTabsHeader() {
		return document.getElementById("tabsHeader");
	}
	function getTabsContainer() {
		return document.getElementById("tabPagesContainer");
	}
	function createTab(url, showName, loadPage){
		tabCount ++;
		// 创建tab标题连接
		var headerHtml = getTabsHeader().firstChild.innerHTML;
		headerHtml += "<a index='"+tabCount+"' url='"+url+"' id='link_"+tabCount+"' name='link_"+tabCount+"' href='javascript:activateTab("+tabCount+")'><span>"+showName+"</span></a>";
		getTabsHeader().firstChild.innerHTML = headerHtml;
		//创建完成后激活tab，如果tabCount == 1无条件加载
		if(tabCount == 1 || loadPage)
			activateTab(tabCount);
	}
	function activateTab(index){
		if(currentTab == index) return;
		if(!index) index = event.srcElement.index;
		if(currentTab > 0){
			document.getElementById("link_"+currentTab).className = "";
			document.getElementById("tabPage_"+currentTab).style.display="none";
		}
		//
		var tabPage = document.all("tabPage_"+index);
		var linkInfo = document.getElementById("link_"+index);
		if(tabPage == null){
			var url = linkInfo.url;
			tabPage = document.createElement("div");
			tabPage.bindUrl = url;
			tabPage.id = "tabPage_" + index;
			tabPage.name = "tabPage_" + index;
			tabPage.style.display="";
			tabPage.style.height="100%";
			tabPage.innerHTML="<iframe frameborder='0' leftmargin='0' marginheight='0' marginwidth='0' scrolling=auto topmargin='0' align='center' id='frame_"+index+"' name='frame_"+index+"' style='height: 100%; width: 96%; overflow-y:hidden' src='"+url+"'></iframe>";
			//
			getTabsContainer().appendChild(tabPage);
		}
		tabPage.style.display="";
		linkInfo.className="sel";
		currentTab = index;
	}
</script>
</head>
<body onLoad="loadTabs()" >

<html:form action="<%=  (String)request.getAttribute(Constants.STRUTS_PATH) %>" method="post">
<html:hidden property="id" />
<html:hidden property="webMethod" />
<framework:table pkStyle="" border="1" cellspacing="0" cellpadding="0" navPosition="none" pageSize="1" displayStyle="form" useStrutsForm="true">
<framework:caption><span class="whf_object_title"><framework:attr source="STRUTS-META" attr="name" /></span></framework:caption>
</framework:table>
<input type='button' onclick='window.history.back()' value='<bean:message key="form.return" />' />
</html:form>

	<!-- tabs begin -->
	<div id="tabsHeader" style="background-color: #FFFFFF;">
		<div>
			<!-- CSS Tabs -->
		</div>
	</div>
	<div id="tabPagesContainer" style="background-color: #FFFFFF; height:600px">
	</div>
	<!-- tabs end -->
</body>
</html> 